home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3.iso
/
chapte21
/
ex13.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-31
|
2KB
|
56 lines
#include <genstub.c>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static TIME_ZONE_INFORMATION tziInit;
switch (uMsg)
{
case WM_CREATE:
GetTimeZoneInformation( &tziInit ); // save time zone data
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST:
{
TIME_ZONE_INFORMATION tziLocal;
DWORD dwTimeZoneMode;
TCHAR szBuffer[128];
dwTimeZoneMode = GetTimeZoneInformation( &tziLocal );
if ( dwTimeZoneMode == TIME_ZONE_ID_STANDARD )
wsprintf( szBuffer,
"Time Zone Name: %sST, Bias: %d",
tziLocal.StandardName,
tziLocal.Bias + tziLocal.StandardBias );
else
wsprintf( szBuffer,
"Time Zone Name: %sDT, Bias: %d",
tziLocal.DaylightName,
tziLocal.Bias + tziLocal.DaylightBias );
MessageBox( hWnd, szBuffer, "Time Zone Data", MB_OK );
// Change time zone data. Add 60 minutes to Bias.
tziLocal.Bias += 60;
SetTimeZoneInformation( &tziLocal );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
SetTimeZoneInformation( &tziInit ); // Restore time zone data
PostQuitMessage( 0 );
break;
default:
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return (NULL);
}